package com.bsj.power.pls.file.uwbData;

import com.bsj.power.common.constant.UWBPosConstant;
import com.bsj.writeFile.WriteAndReadFileAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import redis.clients.bsj.JedisClusterBSJ;

import java.util.List;

/**
 * @author LiJiaXin
 * @version 1.0.0
 * @description 标签设备的原始数据读取
 * @time 2024/5/21 16:35
 */
@Component
public class WRFileBaseUntil {

    private WriteAndReadFileAction writeAndReadFileAction;

    @Autowired
    public JedisClusterBSJ jedisClusterBSJ;

    @Value("${file.path}")
    private String filePath;

    public void init() {
        writeAndReadFileAction = new WriteAndReadFileAction(jedisClusterBSJ, filePath);
        writeAndReadFileAction.settingInterval(10);
        writeAndReadFileAction.start(UWBPosConstant.UWB_BASE_ORIGINAL);
    }

    public List<byte[]> readDataBytes(String id, long startTime, long endTime) {
        return writeAndReadFileAction.readBytesAll(id, startTime, endTime);
    }

}
